package acwing.高精度;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/4
 */
public class BigMul {
    /**
     * 实现
     * a 是个大整数                                145   5 * 12 % 10 = 0        t = 6
     * b 是一个小整数                            x  12   (4 * 12 + 6) % 10 = 4  t = 5
     * c的每一位 = 用a的每一位乘b + t(进位) % 10           (1 * 12 + 5) % 10 = 7  t = 1
     * 进位 t = (a的每一位乘b + t) / 10            1740
     */
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String str = s.next(); // 数字1
        int B = s.nextInt(); // 数字2
        char[] a = str.toCharArray();
        List<Integer> A = new ArrayList<>();
        for (int i = a.length - 1; i >= 0; i--) A.add(a[i] - '0');

        List C = mul(A,B);
        for (int i =  C.size() - 1; i >= 0; i--) System.out.print(C.get(i));

    }

    private static List mul(List<Integer> a, int b) {

        List<Integer> C = new ArrayList<>();
        int t = 0;
        for (int i = 0; i < a.size() || t != 0; i++) {
            if(i < a.size()) t += a.get(i) * b;
            C.add(t % 10);
            t /= 10;
            
        }
        return C;
    }

}
